<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>WEB NAPLO</title>
    </head>
<body>

        <form method="POST"> <!for creating login form>
        <img src="../s_module/Images/LOGO2.jpg" width="100" height="105" alt="LOGO2"/>

        USER ID:<input type="text" name="userid"><br>
        PASSWORD:<input type="password" name="password"><br>
        <input type="submit" name="submit" value="submit">
        </form>

         <?php //for connecting database
         
        $con=mysql_connect("localhost","swami","U6F4BZwXPSUb5nTR");
        mysql_select_db("prasanna",$con);
   
        ?>


        <?php
        session_start();
        if(isset($_POST["submit"]))
        {
            $_session["userid"]=$_POST["userid"];
            $_session["password"]=$_POST["password"];
            $logtab=mysql_query("SELECT * FROM login",$con);
            $logarr=mysql_fetch_array($logtab);
            $findpwd=mysql_query("SELECT password FROM login WHERE id='$_session[userid]' LIMIT 1",$con)or die(mysql_error("Their is some error in your coading or db").'<br> SQL:'.$findpwd);
            $findpwd =  mysql_fetch_row($findpwd);
            //Compare given id & pwd with db to login.
            if($findpwd[0]==$_session["password"] && $_session["userid"]!=NULL && $_session["password"]!=NULL)
            {
                include("profile.php");
                echo "</br>";
               
                //echo "user's password is ".$findpwd[0];
            }
            else{ echo "Wrong username or password"."</br>";}
        }
    
        ?>
       


    </body>
</html>

